Conversation
There was a problem hiding this comment.
Pull request overview
This PR applies code simplifications and modernizations aligned with Ruff linting rule RUF152, focusing on cleaner code patterns and modern typing conventions.
Changes:
- Modernized Protocol typing by using
Selfinstead of custom TypeVar for self-referential types - Simplified code patterns: inline returns, using
max()instead of if-statements, and direct file iteration - Updated Ruff configuration to allow
exec()usage in test files and documentation, and to ignore TRY004 - Updated type checking baseline to reflect the typing improvements
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added S102 exclusions for test files and doc/conf.py (allowing exec), added TRY004 to global ignore list |
| modepy/tools.py | Replaced TypeVar with Self in Reshapeable Protocol, updated matplotlib.tri import style |
| modepy/modal_decay.py | Simplified return statement and replaced if-statement with max() function |
| contrib/weights-from-txt.py | Removed unnecessary .readlines() call when iterating over file |
| contrib/weights-from-fortran.py | Removed shebang line for consistency with other contrib scripts |
| .basedpyright/baseline.json | Updated type checking baseline reflecting the Protocol typing changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #157.